const express = require('express')
const cookieParser = require('cookie-parser')
const session = require('express-session')
const { concatLimit } = require('async')

const app = express()
app.use(cookieParser())
app.use(session({
    secret:'djkk',
    cookie:{
        expires:1000*60*2
    },
    resave:false,
    saveUninitialized:false
}))

app.get('./session',(req,res)=>{
    if(!req.session.name){
        req.session.name='王五'
    }
    res.send("设置session")
})

app.get('/cunt',(req,res)=>{
    if(!req.session.count){
        req.session.count=1
    }
    req.session.count++
    res.send("count:"+req.session.count)
})

app.listen(3000,()=>{
    console.log('服务已启动。。。。post 3000')
})